Don't hide Find My / Shared Albums / Passwords in the menu before state loads - #263
Open
FrankBStack wants to merge 1 commit into
Open
Don't hide Find My / Shared Albums / Passwords in the menu before state loads#263FrankBStack wants to merge 1 commit into
FrankBStack wants to merge 1 commit into
Conversation
…te loads The overflow menu decides whether to show the Find My, Shared Albums and Passwords entries by looking at pushService.state, which is null for the first few seconds after launch. Opening the menu in that window gave a shorter menu than usual, and it stayed that way until the menu was closed and reopened. Remember the last known answer for each service in prefs whenever the push state is assigned, and fall back to that while state is still null. The cache is cleared when state is cleared on logout, so it can't outlive the account it was recorded for. Both the Material and Cupertino menus now go through the backend for these checks instead of poking at the push state directly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pushService.statetakes a few seconds to load after launch. Both overflow menus (MaterialOverflowMenuandCupertinoOverflowMenu) gate the Find My, Shared Albums and Passwords entries onpushService.state?.icloudServices?.*, so if you open the menu during that window those entries are just missing, and the menu keeps rendering without them until it's closed and reopened.Fix:
RustPushService.stateis now a property. Its setter recordsfmfd/sharedstreams/keychainavailability to prefs whenever state is assigned (init, setup, re-registration), and removes those keys when state is set to null on logout so a cached answer can't outlive the account.hasFindMy/hasSharedStreams/hasKeychaingetters return the live answer when state is present and the cached one otherwise.BackendServicegainssupportsSharedStreams()andsupportsKeychain()alongside the existingsupportsFindMy(). The rustpush backend routes all three through the getters above; the HTTP backend returns false for the two new ones (it never had these features).Behavior is identical once state has loaded. The only visible change is that the first menu open after launch matches what you'd see a few seconds later.